/*********************************************************************\
*
*                  (c) lkc
*                  All Rights Reserved. lkc Confidential
*
\*********************************************************************/
/*********************************************************************\
*   Title                      :
*
*   Module Description         :
*
*   Author                     : lkc
*
*   Created                    : 2018-6-24
*
\*********************************************************************/
#ifndef UDPSOCK_POSIX_H
#define UDPSOCK_POSIX_H

#include <arpa/inet.h>
#include "CommBasePosix.h"

class UDPSockPosix : public CommBasePosix
{
public:
    UDPSockPosix(const int port);
    bool Open() override;
    int Send(const unsigned char *sendBuf, const int dataLen) override;
private:
    int Read(unsigned char * readbuf, const int dataLen) override;
private:
    struct sockaddr_in m_clientAddr;  //clent_addr用于记录发送方的地址信息
    socklen_t m_clientLen = sizeof(m_clientAddr);
    bool m_clientHasAddr = false;
    int m_port;
};


#endif // UDPSOCK_POSIX_H

/********************************************************************\
 *
 * REVISION RECORDS
 *
\*********************************************************************/
/*********************************************************************/
/*
 *
 *
 *
\*********************************************************************/
/*------------------------------The End------------------------------*/
